#include "CLabelAdder.h"

CLabelAdder::CLabelAdder(IGUIEnvironment *env, IGUIElement *parent,u16 xStart, u16 yStart, u16 labelWidth, u16 valueWidth)
{
  this->env = env;
  this->parent = parent;

  x1 = xStart;
  y = yStart;

  x2 = x1 + labelWidth;
  x3 = x2 + LABEL_VALUE_PADDING;
  x4 = x3 + valueWidth;
}

CLabelAdder::~CLabelAdder()
{
  //dtor
}


IGUIStaticText* CLabelAdder::addLabel(const wchar_t* label, const wchar_t* value)
{
  IGUIStaticText *temp;
  if ( value != 0 )
  {
    temp = env->addStaticText(label, rect<s32>(x1, y, x2, y+20), false, false, parent);
    temp->setOverrideColor(labelColor);

    temp = env->addStaticText(value, rect<s32>(x3, y, x4, y+20), false, false, parent);
    temp->setOverrideColor(valueColor);
  }

  else
  {
    temp = env->addStaticText(label, rect<s32>(x1, y, x4, y+20), false, false, parent);
    temp->setOverrideColor(labelColor);
  }

  y+= 20;

  return temp;
}

IGUIStaticText* CLabelAdder::addLabel(const wchar_t* label, int value)
{
  stringw temp(value);
  return addLabel(label, temp.c_str());
}

void CLabelAdder::addSpace()
{
  y+= 20;
}

SColor CLabelAdder::labelColor(255, 255, 255, 255);
SColor CLabelAdder::valueColor(255, 255, 255, 255);
